<template>
  <div>
    <h2 class="article_title">{{ this.info.title }}</h2>
    <div class="article_content" v-html="this.info.content">
    </div>
  </div>
</template>

<script>
  import API from  '../../config/api'
  import AboutUsHeader from '../aboutus/child/AboutUsHeader'
  export default {
    data() {
      return {
        // token: store.get('token') || '',
        id:'',
        info:{
          title:'',
          createtime:'',
          content:''
        }
      }
    },
    methods:{
      getParams(){
        // getToken();
        this.id = this.$route.params.id;

        // 请求详细数据
        var url = API.getArticleDetail;
        var params = {
          ids:this.id,
        };

        this.$axios.post(url, params)
          .then((res) => {
            if (res){
              // 打印返回数据
              var info = res;
              // 赋值
              this.info.title = info.title;
              this.info.time = info.createtime;
              this.info.content = info.content;
            }
            else{
              this.$msg('网络异常请检查您当前网络', 'error');
            }
          })
          .catch((err) => {
            this.$msg('网络异常请检查您当前网络', 'error');
          });
      },
    },
    mounted() {
      this.getParams();
    }
  }
</script>

<style scoped>

  .article_title{
    margin: 0.4rem 0;
    padding: 0 0.3rem;
    font-size: 0.45rem;
    line-height: 0.7rem;
  }

  .article_content{
    padding: 0 0.3rem;
  }


</style>
